<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>寄件</title>
    <link rel="stylesheet" href="../css/base.css">
    <script src="../js/jquery-3.2.1.min.js"></script>
    <script src="../js/public.js"></script>
    <link rel="stylesheet" href="../css/mobile-select-area.css">
    <script src="../js/city.js?time=20170801"></script>
    <script src="../js/dialog.js"></script>
    <script src="../js/mobile-select-area.js"></script>

</head>
<style>
    body{
        background: #fff;
    }
    .div-list{
        overflow: hidden;
        height: 40px;
        line-height: 40px;
        border-bottom: 1px solid #ddd;
        padding: 0 5px;
        box-sizing: border-box;
    }
    .li-fl{
        float: left;
        width: 30%;
        color: #333;
    }
    .li-fr{
        float:left;
        width: 70%;
    }
    .footer-btns{
        border-radius: .04rem;
        box-sizing: border-box;
        width: 80%;
        margin: 10px auto;
        background: #5f3104;
        color: #fff;
        line-height: 40px;
        text-align: center;
    }
</style>
<body>
    <div class="div-list">
        <div class="li-fl">
            快递公司
        </div>
        <div class="li-fr" id="kuaidi" style="text-align: right">

        </div>
    </div>
    <div class="div-list">
        <div class="li-fl">
            收件人名字
        </div>
        <div class="li-fr">
            <input type="text" id="sj_name" placeholder="名字" style="width: 100%;border: none;text-align: right;padding-right: .1rem;box-sizing: border-box;">
        </div>
    </div>
    <div class="div-list">
        <div class="li-fl">
            收件人电话
        </div>
        <div class="li-fr">
            <input type="tel" id="sj_phone" placeholder="电话" style="width: 100%;border: none;text-align: right;padding-right: .1rem;box-sizing: border-box;">
        </div>
    </div>
    <div class="div-list">
        <div class="li-fl">
            收件地址
        </div>
        <div class="li-fr">
            <input type="text" id="shengshiqu1" placeholder="省市区" style="width: 100%;border: none;text-align: right;padding-right: .1rem;box-sizing: border-box;">
        </div>
    </div>
    <div class="div-list">
        <div class="li-fl">
            详细地址
        </div>
        <div class="li-fr">
            <input type="text" id="sj_xxaddress" placeholder="详细地址" style="width: 100%;border: none;text-align: right;padding-right: .1rem;box-sizing: border-box;">
        </div>
    </div>
    <div class="div-list">
        <div class="li-fl">
            寄件人名字
        </div>
        <div class="li-fr">
            <input type="text"id="jj_name" placeholder="名字" style="width: 100%;border: none;text-align: right;padding-right: .1rem;box-sizing: border-box;">
        </div>
    </div>
    <div class="div-list">
        <div class="li-fl">
            寄件人电话
        </div>
        <div class="li-fr">
            <input type="tel" id="jj_phone" placeholder="电话" style="width: 100%;border: none;text-align: right;padding-right: .1rem;box-sizing: border-box;">
        </div>
    </div>
    <div class="div-list">
        <div class="li-fl">
            寄件人地址
        </div>
        <div class="li-fr">
            <input type="tel" id="shengshiqu3" placeholder="寄件人地址" style="width: 100%;border: none;text-align: right;padding-right: .1rem;box-sizing: border-box;">
        </div>
    </div>
    <div class="div-list">
        <div class="li-fl">
            详细地址
        </div>
        <div class="li-fr">
            <input type="tel" id="jj_address" placeholder="详细地址" style="width: 100%;border: none;text-align: right;padding-right: .1rem;box-sizing: border-box;">
        </div>
    </div>
    <div class="footer-btns" onclick="truePost()">
        确认
    </div>
<script>
    $(function (){
        var texts = GetQueryString('text')
      $("#kuaidi").text(decodeURI(decodeURI(texts)));
    })
    var _address ={};
    var selectArea2 = new MobileSelectArea();
    selectArea2.init({
        position:"bottom",
        trigger:$('#shengshiqu1'),
        value:$('#shengshiqu1').val(),
        data:json3,
        callback:function (scroller,text,value){
            console.log("vals="+value);
            _address.province = text[0];
            _address.city = text[1];
            _address.area = text[2];
            $("#shengshiqu1").html(_address.province+ " "+_address.city+" "+_address.area);
        }
    });


    var _address3 ={};
    var selectArea3 = new MobileSelectArea();
    selectArea3.init({
        position:"bottom",
        trigger:$('#shengshiqu3'),
        value:$('#shengshiqu3').val(),
        data:json3,
        callback:function (scroller,text,value){
            console.log("vals="+value);
            _address3.province = text[0];
            _address3.city = text[1];
            _address3.area = text[2];
            $("#shengshiqu3").html(_address3.province+ " "+_address3.city+" "+_address3.area);
        }
    });
    function truePost (){
        var _sjval  =$("#sj_name").val();
        var _sjphone = $("#sj_phone").val();
        var _sjxxaddress = $("#sj_xxaddress").val();
        var _sjssq =    _address.province +","+ _address.city+","+_address.area;
        var _jjval = $("#jj_name").val();
        var _jjphone = $("#jj_phone").val();
        var _jjaddress = $("#jj_address").val();
        var _jjshq = _address3.province +","+ _address3.city+","+_address3.area;
        if(isNull(_sjval)|| isNull(_sjphone) || isNull(_sjxxaddress) || isNull(_sjssq) || isNull(_jjval) || isNull(_jjphone) || isNull(_jjaddress) || isNull(_jjshq)){
            alert("请填写完整的信息");
            return false;
        }
        $.ajax({
            url:base_url+"ZITAOHUI/orderOnline",
            data:{
                CourierCompanyNumber:GetQueryString("code"),
                toName:_sjval,
                Mobile:_sjphone,
                ProvinceName:_address.province,
                CityName:_address.city,
                ExpAreaName:_address.area,
                Address:_sjxxaddress,
                senderName:_jjval,
                senderMobile:_jjphone,
                senderProvinceName: _address3.province,
                senderCityName:_address3.city,
                senderExpAreaName:_address3.area,
                senderAddress:_jjaddress
            },
            type:"post",
            dataType:"json",
            success:function (data){
                 console.log(data);
                 if(data.Success){
                     alert("提交成功");c
                     window.location.hfef = "Seller-order.html?tab_num=0";
                 }
            }
        })
    }



</script>

</body>
</html>